﻿using Newtonsoft.Json;
using System.ComponentModel;

namespace RaspberryDebugger
{
    /// <summary>
    ///保存项目的树莓相关设置。  
    /// </summary>
    internal class ProjectSettings
    {
        /// <summary>
        /// 连接组合框项表示禁用Raspberry调试。  
        /// </summary>
        public const string DisabledConnectionName = "[DISABLED]";

        /// <summary>
        /// 连接组合框项指示应该使用默认的树莓连接。  
        /// </summary>
        public const string DefaultConnectionName  = "[DEFAULT]";

        /// <summary>
        /// Default constructor that returns settings with remote debugging disabled.
        /// </summary>
        public ProjectSettings()
        {
            EnableRemoteDebugging = false;
            RemoteDebugTarget     = null;
        }

        /// <summary>
        /// Indicates whether remote debugging is disabled.
        /// </summary>
        [JsonProperty(PropertyName = "EnableRemoteDebugging", Required = Required.Always)]
        public bool EnableRemoteDebugging { get; set; }

        /// <summary>
        /// Specifes the name of the specific remote Raspberry connection to use or
        /// <c>null</c> for the default connection.
        /// </summary>
        [JsonProperty(PropertyName = "RemoteDebugTarget", Required = Required.AllowNull)]
        public string RemoteDebugTarget { get; set; }

        /// <summary>
        /// Specifies the Linux group the program should execute within.  
        /// This defaults to <c>gpio</c>.
        /// </summary>
        [JsonProperty(PropertyName = "TargetGroup", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
        [DefaultValue("gpio")]
        public string TargetGroup { get; set; } = "gpio";
    }
}
